package com.itheima.mapper;

import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * @Description: StudentMapper
 * @Author: HH
 * @Date: 2025/4/19 16:53
 **/

/**
 * 学员管理Mapper
 */
@Mapper
public interface StudentMapper {

    /**
     * 根据班级id查询学生
     */
    @Select("select count(*) from student where clazz_id = #{clazzId}")
    int countByClazzId(Integer clazzId);

    /**
     * 条件分页查询学员信息
     * @param param
     * @return
     */
    List<Student> list(StudentQueryParam param);

    /**
     * 添加学员信息
     * @param student
     */
    void insert(Student student);

    /**
     * 根据id查询学员信息
     * @param id
     * @return
     */
    @Select("select * from student where id = #{id}")
    Student getInfo(Integer id);

    /**
     * 修改学员信息
     */
    void update(Student student);

    /**
     * 批量删除学员信息
     * @param ids
     */
    void deleteByIds(List<Integer> ids);

    /**
     * 违纪处理
     * @param id
     * @param score
     */
    void handle(Integer id, Integer score);

    /**
     * 学员学历统计
     * @return
     */
    List<Map> countStudentDegreeData();
}
